/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package supermarket;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Nicolas
 */
public class A {
    List<B> myList;
    private B objB;
    public A(){
        myList = new ArrayList<>();
        B1 objB1=new B1(10);
        objB=objB1;
    }
    
    public void createB(int val, boolean b){
        if (b)
            myList.add(new B1(val));
        else 
            myList.add(new B2(val));
    }
    
}
